{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Stacked Area Chart\n",
    "==================\n",
    "This example shows how to make a stacked area chart using a dataset containing monthly casualty counts from the Crimean war. Note that the dataset is reshaped into a tidy format before plotting.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "import pandas as pd\n",
    "\n",
    "crimea = pd.melt(data.crimea(), id_vars=['date'],\n",
    "                 value_vars=['disease', 'other', 'wounds'],\n",
    "                 var_name='cause',\n",
    "                 value_name='deaths')\n",
    "\n",
    "alt.Chart(crimea).mark_area().encode(\n",
    "    x='date',\n",
    "    y='sum(deaths)',\n",
    "    color='cause'\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
